#include "widget.h"
#include "ui_widget.h"
#include <QRegExpValidator>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QRegExp ret("^1\\d{10}$");
    ui->lineEdit->setValidator(new QRegExpValidator(ret));
}
Widget::~Widget()
{
    delete ui;
}


void Widget::on_lineEdit_textEdited(const QString &arg1)
{
    QString test = arg1;
    int p = 0;
    if(ui->lineEdit->validator()->validate(test, p) == QValidator::Acceptable)
        ui->pushButton->setEnabled(true);
    else
        ui->pushButton->setEnabled(false);
}

void Widget::on_pushButton_clicked()
{
    qDebug() << "成功上传电话号码" << endl;
}
